/*
 * @Author: C.
 * @Date: 2022-02-28 16:44:51
 * @LastEditTime: 2022-03-01 14:33:01
 * @Description: file content
 */
export { getTableData } from "./data";
import { tmp } from "./printTmp";
function getTmp(tmpId){
  if(window.localStorage.getItem(tmpId)){
    return JSON.parse(window.localStorage.getItem(tmpId))
  }else{
    return JSON.stringify(tmp)
  }
}
// const Data={
//   Items:[
//     {
//   Category: "v9-sales",
//    Content: getTmp("cwind_printT1") ,
//    Id: "cwind_printT1",
//    Name: "模板1",
//    State: true,
//   },
//   {
//     Category: "v9-sales",
//      Content: getTmp("cwind_printT2"),
//      Id:"cwind_printT2" ,
//      Name: "模板2",
//      State: true,
//     }
//   ],
//   Count: 2
// }
export function getTempList(){
  return new Promise((r, e) => {
    r({
      Items:[
        {
      Category: "v9-sales",
       Content: getTmp("cwind_printT1") ,
       Id: "cwind_printT1",
       Name: "模板1",
       State: true,
      },
      {
        Category: "v9-sales",
         Content: getTmp("cwind_printT2"),
         Id:"cwind_printT2" ,
         Name: "模板2",
         State: true,
        }
      ],
      Count: 2
    });
  });
}
export function saveTemp(tmp){
  return new Promise((r, e) => {
    console.log(tmp.Content);
    setTimeout(()=>{
      window.localStorage.setItem(tmp.Id,JSON.stringify(tmp.Content))
      r(true);
    })
  });
}

